
    <!-- 项目管理 -->
    <template>
      <div class="page-box h100 display-flex czbj">
        <p class="title-label mb10">工程案例</p>
        <!-- sonRouter="yybureauFormationBJ" 为跳转新的页面编辑 -->
        <dxtable :dataJson="dataJson" :portUrl="portUrl" :formJson="formJson" :qx="qx" ref="databale" ></dxtable>
      </div>
    </template>
    <script lang='ts' setup>
    import dxtable from "../../components/util/dxtable.vue";
    import sort from "../../components/util/sort.vue";
    import { dxget, dxpost } from "../../util/index";
    import { NButton, NImage, NTag } from "naive-ui"
    import { h, ref, reactive } from "vue";
    const databale = ref();
    const kxcdf = ref(false)
    const xmlxSelect = ref([])
    const initeer = () => {
      databale.value.initDataExpose();
    };
    let dataJson = [
        {
            "title": "标题",
            "type": "input",
            "val": "",
            "icon": "dx-shurukuang",
            "span": 24,
            "key": "title",
            "width": "",
            "search": true,
            "istable": true,
            "required": true
        },
        // {
        //     "title": "副标题",
        //     "type": "input",
        //     "val": "",
        //     "icon": "dx-shurukuang",
        //     "span": 24,
        //     "key": "subheading",
        //     "width": "",
        //     "search": false,
        //     "istable": true,
        //     "required": true
        // },
        {
            "title": "封面",
            "type": "img",
            "val": "",
            "icon": "dx-img",
            "span": 12,
            "key": "cover",
            "width": "",
            "search": false,
            "istable": true,
            "required": true
        },
        {
            "title": "新闻类型",
            "type": "select",
            "icon": "dx-biaodanzujian-xialakuang",
            "options": [],
            "search": true,
            render:(row)=>{
              try{
                return xmlxSelect.value.filter(a=>a.value==row.newsxw)[0].label
              }catch(e){
                console.log(e);
              }
              return '--'
            }
        },
      {
      title: "排序",
      width: 100,
      render:(row)=>{
        row.sjk = "xtgx" //数据库
        row.databaseName = "keyEnterprise"; //表名
        return h(sort, {
          row,
          onCallBack: () => {
            initeer();
          },
        });
      },
    },
    {
      title: "添加时间",
      key: "addTime",
      width: 150,
    }];
    
    
    
    const qx = {
      DeletePermissionID: "hlxnanlidel", //删除
      EditPermissionIdentifier: "hlxnanlibj", // 编辑
      NewPermissionIdentifier: "hlxnanlixz", // 新建
      ViewPermissionID: "hlxnanlick", // 查看
    };
    const portUrl = "hlxn/nb?type=3";
    
    let formJson = reactive([
        {
            "title": "标题",
            "type": "input",
            "val": "",
            "icon": "dx-shurukuang",
            "span": 24,
            "key": "title",
            "width": "",
            "search": false,
            "istable": true,
            "required": true
        },
     
        {
            "title": "封面",
            "type": "img",
            "val": "",
            "icon": "dx-img",
            "span": 12,
            "key": "cover",
            "width": "",
            "search": false,
            "istable": true,
            "required": true
        },
        {
            "title": "新闻类型",
            "type": "select",
            "icon": "dx-biaodanzujian-xialakuang",
            "options": [],
            "val": "1",
            "span": 12,
            "key": "newsxw",
            "width": "",
            "search": false,
            "istable": true,
            "required": true
           
        },
        {
            "title": "详情",
            "type": "fwb",
            "val": "",
            "icon": "dx-m-fuwenben",
            "span": 24,
            "key": "details",
            "width": "",
            "search": false,
            "istable": false,
            "required": false,
            "callBack":(data)=>{
              databale.value.setmodel('subheading',data)
            }

        }
    ]);
    const czFun = {
      fun: (row) => {
        return [
          h(
            NButton,
            {
              type: "info",
              quaternary: true,
              onClick: async (e) => {
    
              },
            },
            "复制代码"
          )
    
        ];
      },
    };
    

        // 获取字典内容
        const xtgxxmfl = async () => {
      const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'hlxnxwdt' })
      dataJson[2].options = [
        {
          label: "全部",
          value: ""
        },
        ...data
      ]
      formJson[2].options = data
      xmlxSelect.value = data
      console.log(data);
      kxcdf.value = true
    }
    xtgxxmfl()
    
    </script>
    <style scoped></style>
        